﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Modules_Account_EditUser : System.Web.UI.Page
{
    public string UserName { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserName = CommonHelper.QueryString("UserName", "");
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        ProfileCommon userProfile = Profile.GetProfile(UserName);
        txtUserName.Text = userProfile.FullName;
        hdfimg.Value = Avatar.ImageUrl = userProfile.Avatar;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            ProfileCommon userProfile = Profile.GetProfile(UserName);
            userProfile.FullName = txtUserName.Text;
            userProfile.Avatar = hdfimg.Value;
            userProfile.Save();
            lblError.Text = "Update Successfull";
            LoadData();
        }
        catch (Exception)
        {
            lblError.Text = "Update Error";
        }
    }
}